﻿using MySql.Data.MySqlClient;
using SGV.Datos.Interfases;
using SGV.Entidad;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using DapperExtensions;

namespace SGV.Datos.Repositories
{
    public class TipoIvaRepository :ITipoIvaRepository
    {

        private IDbConnection _Db;

        public TipoIvaRepository()
        {
            //constructor
        }


        public IList<TipoIva> FindAll()
        {
           using (_Db = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ToString()))
           {
               const string query = @"SELECT id, denominacion FROM tipoiva";
               return _Db.Query<TipoIva>(query).ToList();
           }
        }

        public IQueryable<TipoIva> Find(Expression<Func<TipoIva, bool>> predicate)
        {
            throw new NotImplementedException();
        }

        public TipoIva FindById(int id)
        {
            throw new NotImplementedException();
        }

        public int add(TipoIva newEntity)
        {
            throw new NotImplementedException();
        }

        public bool remove(int id)
        {
            throw new NotImplementedException();
        }

        public int Modify(TipoIva entity)
        {
            throw new NotImplementedException();
        }
    }
}
